<template>
  <el-dialog title="任务列表" :visible.sync="open" width="1600px">
    <el-button v-if="exportMethod" type="danger" icon="el-icon-download" size="mini" @click="handleExport" style="margin-bottom: 10px">导出
    </el-button>
    <el-table v-loading="pickLoading" ref="singleTable" :data="pickData"
              style="width: 100%">
      <el-table-column label="姓名" align="center" prop="userName"/>
      <el-table-column label="工号" align="center" prop="jobNumber"/>
      <el-table-column label="手机号" align="center" prop="phonenumber"/>
      <el-table-column label="所在部门" align="center" prop="ancestorNames"/>
    </el-table>
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="pickParams.pageNum"
      :limit.sync="pickParams.pageSize"
      @pagination="getList"
    />
    <div style="text-align: center; margin-top: 40px">
      <el-button type="primary" @click="pickCancel">返 回</el-button>
    </div>
  </el-dialog>
</template>

<script>
import {listPick} from "@/api/examine/active/api";
import {statisticsDetail} from "@/api/examine/performance/api";

export default {
  name: "statisticsDialog",
  props:{
    exportMethod:{
      type:Function,
      default:null
    }
  },
  data() {
    return {
      open: false,
      pickLoading: false,
      pickData: [],
      total: 0,
      pickParams: {
        pageNum: 1,
        pageSize: 10
      },
    }
  },
  methods: {
    dialogOpen(data) {
      this.open = true;
      this.pickParams.examineStatus=data.examineStatus
      this.pickParams.approveStatus= data.approveStatus
      this.pickParams.examineType=data.examineType
      this.pickParams.examineResult=data.examineResult
      this.pickParams.isSubmitted=data.isSubmitted
      this.pickParams.deptSearchStr=data.deptSearchStr
      this.pickParams.id=data.id
      this.pickParams.ancestorNames=data.ancestorNames
      this.pickParams.pickCycleText=data.pickCycleText
      this.pickParams.examineCycle=data.examineCycle
      this.getList()
    },
    getList() {
      this.pickLoading = true;
      statisticsDetail(this.pickParams).then(resp => {
        this.pickData = resp.rows
        this.total = resp.total;
      }).finally(() => {
        this.pickLoading = false;
      })
    },
    handleExport(){
      if(this.exportMethod){
        this.exportMethod();
      }
    },
    pickCancel() {
      this.resetForm("pickParams");
      this.pickParams={}
      this.open = false
    }
  }
}
</script>

<style scoped>

</style>
